SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vw_UsuarioOrganizacion
AS
/*
SELECT     Organizacion
FROM         dbo.tb_Reparticiones
WHERE     (idReparticion =
                          (SELECT     idreparticion
                            FROM          tb_usuarios
                            WHERE      ntuser = SYSTEM_USER))

*/


SELECT  IdOrganizacion AS Organizacion
FROM tb_OrganizacionesporReparticion 
WHERE     (idReparticion =
                          (SELECT     idreparticion
                            FROM          tb_usuarios
                            WHERE      ntuser = SYSTEM_USER))

GO
GRANT SELECT ON  [dbo].[vw_UsuarioOrganizacion] TO [public]
GRANT SELECT ON  [dbo].[vw_UsuarioOrganizacion] TO [SoloVer]
GO
